<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<base href="<%=basePath%>">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>退役军人信息管理系统</title>
	<link rel="stylesheet" type="text/css" href="css/public.css" />
	<link rel="stylesheet" type="text/css" href="css/page.css" />
	<link rel="stylesheet" type="text/css" href="css/css.css" />
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/public.js"></script>
	<script src="js/jquery-3.6.0.js"></script>
	<style type="text/css">
        div.Soldier_login{
            height: 19px;
            width: 120px;
            position: absolute;
            top:50px;
	        right:50px;
        }
       div.Enterprise_login{
            height: 19px;
            width: 120px;
           position: absolute;
           top:90px;
           right:50px;
        }
        .bbD .bbDP .btn_yes1{
            height: 50px;
            width: 100%;
        }
	</style>
	<script>
        function admin_login(e){
            var formObject = {};
            var formArray =$("#form1").serializeArray();
            $.each(formArray,function(i,item){
                formObject[item.name] = item.value;
            });
            $.ajax({
                url:'admin_info/login',
                headers: {
                    'Content-Type': 'application/json;charset=utf-8',
                },
                type:'POST',
                data:JSON.stringify(formObject),
                dataType: "json",
                success:function(data){
                    if(data.code == '0000'){
                        console.log(data.message);
                        alert("欢迎登录");
                        window.location.href="jsp/admin_view.jsp";
                    }
                    else if(data.code=='0001'){
                        console.log(data.message);
                        alert("账号不存在");
                        window.location.reload();
                    }
                    else if(data.code=='0002'){
                        alert("密码错误");
                        window.location.reload();
                    }

                }
            })
        }
	</script>
</head>
<body>
<form id="form1">
	<!-- 登录body -->
	<div class="logDiv">
		<img class="logBanner" src="img/logBanner.png" />
		<div class="logGet">
			<!-- 头部提示信息 -->
			<div class="logD logDtip">
				<p class="p1">管理员登录</p>
			</div>
			<!-- 输入框 -->
			<div class="lgD">
				<img class="img1" src="img/logName.png" /><input type="text" name="admAccount"
				                                                 placeholder="输入账号" />
			</div>
			<div class="lgD">
				<img class="img1" src="img/logPwd.png" /><input type="password" name="admPassword"
				                                                placeholder="输入密码" />
				<div class="bbD">
					<p class="bbDP">
						<span class="btn_ok btn_yes1" onclick="admin_login()"><input type="hidden" />登录</span>
					</p>
				</div>
			</div>
		</div>
		<div class="Soldier_login">
			<button style="background-color:rgb(238, 239, 194);border:none;"><a href="jsp/Soldier_login.jsp" style="color:black"><img src="img/coin10.png" height="15px"/>退役军人登录</a></button>
		</div>
		<div class="Enterprise_login">
			<button style="background-color:rgb(238, 239, 194);border:none;"><a href="jsp/Enterprise_login.jsp" style="color:black"><img src="img/coin07.png" height="15px"/>企业用户登录</a></button>
		</div>
	</div>
	<!-- 登录body  end -->


	<!-- 登录页面底部 -->
	<div class="logFoot">
		<p class="p1">版权所有：退役军人信息管理</p>
		<p class="p2">123456789</p>
	</div>
	<!-- 登录页面底部end -->
</form>
</body>
</html>